$(document).ready(function(){

 	//初始化请求
    $.get("header_menu.html",function(data){ $("#header").html(data); });
    $.get("footer.html",function(data){ $("#footer").html(data); });

 	$.ajax({
 		type:"get",
 		url:"https://www.hgxrshn.com/MgMain",
 		async:true,
 		success:function(data){
 		   index_View(data);
 		}
 	});
 	
    function index_View(data){
    	var B_node = $('.b_text');
    	for (var i=0;i<data.length;i++ ) {
    		if(i<=7){
    			$('.inner').find('span').eq(i).text(data[i])
    		}
    		if(i>=11){
    			
    			B_node.eq(i-11).text(data[i])
    		}
    	}
    	
    	var tabs1 = `<tr>
              				 	 <td>周一</td>
              				 	 <td>${data[9][0]}</td>
              				 	 <td>${data[8][0]}</td>
              				 </tr>
              				 <tr>
              				 	 <td>周二</td>
              				 	 <td>${data[9][1]}</td>
              				 	 <td>${data[8][1]}</td>
              				 </tr>
              				 <tr>
              				 	 <td>周三</td>
              				 	 <td>${data[9][2]}</td>
              				 	 <td>${data[8][2]}</td>
              				 </tr>
              				 <tr>
              				 	 <td>周四</td>
              				 	 <td>${data[9][3]}</td>
              				 	 <td>${data[8][3]}</td>
              				 </tr>
              				 <tr>
              				 	 <td>周五</td>
              				 	 <td>${data[9][4]}</td>
              				 	 <td>${data[8][4]}</td>
              				 </tr>
              				 <tr>
              				 	 <td>周六</td>
              				 	 <td>${data[9][5]}</td>
              				 	 <td>${data[8][5]}</td>
              				 </tr>
              				 <tr>
              				 	 <td>周日</td>
              				 	 <td>${data[9][6]}</td>
              				 	 <td>${data[8][6]}</td>
              				 </tr>
    	`;
    	 var tabs2 = `<tr>
              				 	 <td>周一</td>
              				 	 <td>${data[10][0]}</td>
              				 </tr>
              				 <tr>
              				 	 <td>周二</td>
              				 	 <td>${data[10][1]}</td>
              				 </tr>
              				 <tr>
              				 	 <td>周三</td>
              				 	 <td>${data[10][2]}</td>
              				 </tr>
              				 <tr>
              				 	 <td>周四</td>
              				 	 <td>${data[10][3]}</td>
              				 </tr>
              				 <tr>
              				 	 <td>周五</td>
              				 	 <td>${data[10][4]}</td>
              				 </tr>
              				 <tr>
              				 	 <td>周六</td>
              				 	 <td>${data[10][5]}</td>
              				 </tr>
              				 <tr>
              				 	 <td>周日</td>
              				 	 <td>${data[10][6]}</td>
              				 </tr>`;
    	$('.incr1').append(tabs1);
    	$('.incr2').append(tabs2);
        var myChart1 = echarts.init(document.getElementById('my_chart'),'macarons');
 	    var myChart2 = echarts.init(document.getElementById('my_chart2'),'macarons');
        myChart1.setOption({
			    tooltip : {
			        trigger: 'axis'
			    },
			    legend: {
			        data:['收入数据']
			    },
			    calculable : true,
			    xAxis : [
			        {
			            data : ['周一','周二','周三','周四','周五','周六','周日']
			        }
			    ],
			    yAxis : [
			        {
			            type : 'value'
			        }
			    ],
			    series : [
			       {
			            name:'收入数据',
			            type:'line',
			            data:data[10]
			            
			       }
			    ]
			    
			});
			myChart2.setOption({
			    tooltip : {
			        trigger: 'axis'
			    },
			    legend: {
			        data:['注册新增','会员新增']
			    },
			    calculable : true,
			    xAxis : [
			        {
			            data : ['周一','周二','周三','周四','周五','周六','周日']
			        }
			    ],
			    yAxis : [
			        {
			            type : 'value'
			        }
			    ],
			    series : [
			       {
			            name:'注册新增',
			            type:'line',
			            data:data[8]
			            
			       },
			       {
			            name:'会员新增',
			            type:'line',
			            data:data[9]
			            
			        }
			    ]
			    
			});
    	
    }

		})
